<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/echarts.min.js"></script>
</head>
<body>
    <div id="main" style="width: 600px;height:400px;"></div>
    <div id="box" style="width: 600px;height:400px;"></div>
    
    <script>
        function fn1() {
                    // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'));

// 指定图表的配置项和数据
    var option = {
    title: {
        text: 'ECharts 入门示例'
    },
    tooltip: {},
    legend: {
        data: ['销量']
    },
    xAxis: {
        data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子']
    },
    yAxis: {},
    series: [
        {
        name: '销量',
        type: 'bar',
        data: [5, 20, 36, 10, 10, 20]
        }
    ]
    };

// 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

}
        fn1()

        function fn2() {
                    // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('box'));

// 指定图表的配置项和数据
    var option = {
  title: {
    text: 'Stacked Line',
    textStyle:{
      color:'pink',
      fontSize:30
    },
    left:'center',
    top:20
  },
  tooltip: {
    trigger: 'axis'
  },
  legend: {
    data: ['本周收入', 'Union Ads', 'Video Ads', 'Direct', 'Search Engine']
  },
  grid: {
    left: '3%',
    right: '4%',
    // top: '0%',
    bottom: '3%',
    containLabel: true
  },
  toolbox: {
    feature: {
      saveAsImage: {}
    }
  },
  xAxis: {
    type: 'category',
    boundaryGap: false,
    data: ['一月', '二月', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun']
  },
  yAxis: {
    type: 'value'
  },
  color: [{
  type: 'linear',
  x: 0,
  y: 0,
  x2: 1,
  y2: 0,
  colorStops: [{
      offset: 0, color: 'red' // 0% 处的颜色
  }, {
      offset: 1, color: 'blue' // 100% 处的颜色
  }],
  global: false // 缺省为 false
},
// 径向渐变，前三个参数分别是圆心 x, y 和半径，取值同线性渐变
'pink','skyblue'],
  series: [
    {
      name: '本周收入',
      type: 'bar',
      // stack: 'Total',
      data: [120, 132, 101, 134, 90, 230, 210]
    },
    {
      name: 'Union Ads',
      type: 'bar',
      // stack: 'Total',
      data: [220, 182, 191, 234, 290, 330, 310]
    },
    {
      name: 'Video Ads',
      type: 'bar',
      stack: 'Total',
      data: [150, 232, 201, 154, 190, 330, 410]
    },
    
  ]
};

// 使用刚指定的配置项和数据显示图表。
    myChart.setOption(option);

}
        fn2()

    </script>
</body>
</html>